#region File Description
//-----------------------------------------------------------------------------
// PhoneMainMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

using System;

using Microsoft.Xna.Framework;

namespace SpaceGame
{
    class PhoneMainMenuScreen : PhoneMenuScreen
    {
        public PhoneMainMenuScreen()
            : base(StringData.main_screen_title)
        {
            // Create a button to start the game
            Button playButton = new Button(StringData.play_text);
            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);

			Button optionsButton = new Button(StringData.options_text);
			optionsButton.Tapped += new EventHandler<EventArgs>(optionsButton_Tapped);
			MenuButtons.Add(optionsButton);

			Button quitButton = new Button(StringData.quit_text);
			quitButton.Tapped += new EventHandler<EventArgs>(quitButton_Tapped);
			MenuButtons.Add(quitButton);
        }

		void quitButton_Tapped(object sender, EventArgs e)
		{
			ScreenManager.Game.Exit();
		}

		void optionsButton_Tapped(object sender, EventArgs e)
		{
			ScreenManager.AddScreen(new OptionsMenuScreen());
		}

        void playButton_Tapped(object sender, EventArgs e)
        {
            // When the "Play" button is tapped, we load the GameplayScreen
			LoadingScreen.Load(ScreenManager, LoadGameplayScreen, true);
        }

		/// <summary>
		/// Loading screen callback for activating the gameplay screen.
		/// </summary>
		void LoadGameplayScreen(object sender, EventArgs e)
		{
			GameplayScreen gameplayScreen = new GameplayScreen();
			gameplayScreen.ScreenManager = this.ScreenManager;
			gameplayScreen.Initialize();
			ScreenManager.AddScreen(gameplayScreen);
		}

        void sfxButton_Tapped(object sender, EventArgs e)
        {
            BooleanButton button = sender as BooleanButton;

            // In a real game, you'd want to store away the value of 
            // the button to turn off sounds here. :)
        }

        void musicButton_Tapped(object sender, EventArgs e)
        {
            BooleanButton button = sender as BooleanButton;

            // In a real game, you'd want to store away the value of 
            // the button to turn off music here. :)
        }

        protected override void OnCancel()
        {
            ScreenManager.Game.Exit();
            base.OnCancel();
        }
    }
}
